﻿#include <iostream>
#include <vector>
#include <list>
#include <string>

using namespace std;

template<typename T> typename T::size_type print(const T& c)	// must using `typename` to modify `T::size_type`
{
	typename T::size_type n = 0;
	for (; n < c.size(); ++n)
		cout << c[n] << endl;
	return n;
}

template<typename T> void print(const T& beg, const T& end)
{
	T cursor = beg;
	for (; cursor != end; ++cursor)
		cout << *cursor << endl;
}

int main()
{
	vector<int> v{ 1, 2, 3, 4, 5 };
	print<vector<int>>(v);
	list<std::string> l{ "this", "is", "a", "test" };
	print<list<std::string>::const_iterator>(l.cbegin(), l.cend());
	print(v.cbegin(), v.cend());
	return 0;
}

